package com.tliaswebmanagement.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Aspect
@Component
@Slf4j
@Order(1)
public class Aspect3 {
    @Before("execution(* com.tliaswebmanagement.service.*.*(..))")
    public void before(JoinPoint joinPoint) {
        Object target = joinPoint.getTarget();
        log.info("目标类的名称{}", target);

        Signature signature = joinPoint.getSignature();
        String name = signature.getName();
        log.info("方法的名称:{}", name);

        Object[] args = joinPoint.getArgs();
        log.info("方法的参数,{}", Arrays.toString(args));
    }

}
